package com.yangguang.huahui.ui.adapters;

import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;

import com.yangguang.huahui.Config;
import com.yangguang.huahui.R;
import com.yangguang.huahui.baseadapter.BaseQuickAdapter;
import com.yangguang.huahui.baseadapter.BaseViewHolder;
import com.yangguang.huahui.entity.AttentionList;
import com.yangguang.huahui.ui.activitys.DetailActivity;
import com.yangguang.huahui.utils.CommonUtil;
import com.yangguang.huahui.utils.ImageLoader;

import java.util.Calendar;
import java.util.List;

/**
 * Created by Administrator on 2017/3/3.
 */

public class MiaomuAdapter extends BaseQuickAdapter<AttentionList.ListBean> {

    public MiaomuAdapter(int layoutResId, List<AttentionList.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, final AttentionList.ListBean listBean) {
        ImageLoader.load(mContext, listBean.getCarousel(), (ImageView) helper.getView(R.id.iv_miaomu), R.mipmap.load_fail);
        helper.setText(R.id.tv_title, listBean.getGoods_title());
        helper.setText(R.id.tv_price, listBean.getPrice());
        helper.setText(R.id.tv_source, listBean.getSource_of_supply_name());
        if (!CommonUtil.isNull(listBean.getRelease_time())) {
            helper.setText(R.id.tv_date, "发布时间：" + CommonUtil.longToTime(Long.parseLong(listBean.getRelease_time()+"000"), Calendar.DATE));
        }else {
            helper.setText(R.id.tv_date, "发布时间：");
        }
    }
}
